<?php

class Admin_AjaxController extends Zend_Controller_Action {

   private $_isAjax;
   
   public function init() {
      //if($this->_request->isXmlHttpRequest()) {
         //The request was made with JS XmlHttpRequest
         $this->_isAjax = true;
         
         // Disable the main layout renderer
         $this->_helper->layout->disableLayout();
         // Do not even attempt to render a view
         $this->_helper->viewRenderer->setNoRender(true);

         
      //}
   }
   
   public function groupsAction() {
     
      $id = $this->getRequest()->getParam('id');
      $model = new Model_Group();
      $group = $model->findOneBy('id', $id);
      $data['id'] = $group->id;
      $data['name'] = $group->name;

      $jsonData = Zend_Json::encode($data);
      $this->getResponse()->appendBody($jsonData);

   }
   
}
